<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
	</body>
</html>
<script>
	function deobj(obj) {
		var arr = []
		duce(arr, obj)
		return arr
	}

	function duce(aa, obj) {
		for (var i in obj) {
			if (obj.children && obj.children.length > 0) {
				aa.push(duce(aa, obj.children[i]))
			} else {
				aa.push(obj)
				// console.log(obj)
				// return obj
			}
		}
		return obj
	}

	let trarr = {
		name: 123,
		id: 1,
		children: [{
				name: 453,
				id: 456,
				children: [{
					name: 789,
					id: 777,
					children: [{
						name: "hahahqqq---qq",
						id: 3232,
						children: [{
							name: 'son',
							id: "13132123211"
						}]
					}]
				}]
			},
			{
				name: "Cessihshis",
				id: 12121
			}
		]
	}
	console.log(deobj(trarr))
</script>
